import requests
import random
from util.proxies import get_proxies, get_proxy_poll

urls = [f'http://httpbin.org/get?age={i}' for i in range(100)]
porxy_poll = get_proxy_poll()

while len(urls):
    url = urls.pop()
    porxy = random.choice(porxy_poll)
    try:
        response = requests.get(url, proxies=porxy)
        print(response.json())
    except requests.exceptions.ProxyError as e:
        print('代理错误', e)
    except Exception as e:
        print('未知错误', e)
        urls.append(url)
